




*------------------------------------------------------------------------------
*  Dynamics in individual-level attitudes on federal and provincial level
*------------------------------------------------------------------------------

putexcel set "tables\dynamic_individuallevel.xlsx", sheet(attitudes) modify

putexcel A3 = "CDU/CSU"
putexcel A4 = "SPD"
putexcel A5 = "FDP"
putexcel A6 = "Grüne"
putexcel A7 = "Linke"
putexcel A8 = "AfD"

putexcel B1 = "Kandidaten"
putexcel B2 = "nicht gleichläufig"
putexcel C2 = "Bund & Land stabil"
putexcel D2 = "gleichläufig"
putexcel E1 = "Parteien"
putexcel E2 = "nicht gleichläufig"
putexcel F2 = "Bund & Land stabil"
putexcel G2 = "gleichläufig"

//Formatting
putexcel A1:A8, right border(right) overwritefmt
putexcel B1:G1,  bold  overwritefmt
putexcel B2:G2, hcenter bold border(bottom) overwritefmt
putexcel A1:A8, border(right double) 

//Candidates: Export distribution to Excel
local zeile = 2
foreach party in cdu spd fdp gru lin {
	local zeile = `zeile' + 1
		fre dyn_B_L_cand`party'	
		putexcel B`zeile' = matrix(r(valid)'/r(N_valid)), nformat(percent)
}

//Parties: Export distribution to Excel
local zeile = 2
foreach party in cdu spd fdp gru  afd {
	local zeile = `zeile' + 1
		fre dyn_B_L_scal`party'	
		putexcel E`zeile' = matrix(r(valid)'/r(N_valid)), nformat(percent)
}
